package com.futures.investm.adapter;


import android.view.View;
import android.widget.ImageView;

import com.futures.investm.R;
import com.futures.investm.entity.HandpickEntity;
import com.futures.investm.test.SensitiveWordsUtils;
import com.futures.investm.utils.IntentUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.HashSet;
import java.util.Set;

import tech.com.commoncore.manager.GlideManager;


public class HandPickAdapter extends BaseQuickAdapter<HandpickEntity, BaseViewHolder> {


    public HandPickAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, final HandpickEntity item) {

//        Set<String> strings = new HashSet<>();
//        strings.add("分水岭");
//        strings.add("老朋友");
//        SensitiveWordsUtils.init(strings);
//        String str = SensitiveWordsUtils.replaceSensitiveWord(item.getTitle(), "林彬");


        helper.setText(R.id.tv_title, item.getTitle());

        ImageView view = helper.getView(R.id.img);

        GlideManager.loadImg(item.getImages(), view);

        helper.setText(R.id.tv_time, item.getTime());

        helper.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                IntentUtils.goNewsDetailsActivity(mContext, item.getTitle(), item.getImages(), item.getTime(), item.getContent());
            }
        });


    }
}
